import { createRouter, createWebHistory } from 'vue-router'
import FirstPage from '@/components/FirstPage/FirstPage.vue'
import LoginPage from '@/views/Login/LoginPage.vue'
import LoginForm from '@/views/Login/LoginForm.vue'
import RegisterForm from '@/views/Login/RegisterForm.vue'
import AdminPage from '@/views/Admin/AdminPage.vue'
import Article from '@/views/Admin/article/index.vue'
import Tags from '@/views/Admin/tags/index.vue'
import Users from '@/views/Admin/users/index.vue'
import Basic from '@/views/Admin/basic/index.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: FirstPage,
    },
    {
      path: '/login',
      name: 'login',
      component: LoginPage,
      children: [
       {
         path: '',
         component: LoginForm
       },
       {
         path: 'register',
         component: RegisterForm
       }
     ]
    },
    {
      path: '/admin',
      name: 'admin',
      component: AdminPage,
      children: [
        {
          path: '',
          component: Article
        },
        {
          path: 'tags',
          component: Tags
        },
        {
          path: 'users',
          component: Users
        },
        {
          path: 'basic',
          component: Basic
        }
      ]
    }
  ],
})

export default router
